import request from "@/utils/request";
import type { ILogin, IResponseBody } from "./userApi";

// 查找班级所有学生
export function getStudentAll(
  class_id: number,
  page = 1,
  limit = 100
): Promise<IResponseBody> {
  return request.post("/user/findById", {
    class_id,
    page,
    limit,
  });
}

export interface IAddStudnetData {
  classId: string;
  nickname: string;
  account: string;
  password: string;
}

export function addStudnet(data: IAddStudnetData): Promise<IResponseBody> {
  return request.post("/user/create", data);
}

export function login(data: ILogin): Promise<IResponseBody> {
  return request.post("/user/login", data);
}
